package tech.aistar.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tech.aistar.entity.Register;
import tech.aistar.entity.Tenant;

public interface TenantMapper {

    @Select("select * from tenant where id=#{id}")
    Tenant selectById(Integer id);

    @Update("update tenant set phone=#{phone} where id=#{id}")
    int updateById(@Param("phone") String phone, @Param("id") Integer id);

    @Update("update tenant set name=#{name} where id=#{id}")
    int updateNameById(@Param("name") String name, @Param("id") Integer id);

    @Update("update tenant set gender=#{gender} where id=#{id}")
    int updategenderById(@Param("gender") String gender, @Param("id") Integer id);

    @Update("update tenant set identity_card_number=#{iden},name=#{name},gender=#{gender} where id=#{id}")
    int updateIdentityById(@Param("iden") String identityCardNumber,@Param("name") String name,@Param("gender") String gender, @Param("id") Integer id);

    @Select("select * from tenant where register_id=#{registerId}")
    Tenant selectByregisterId(Integer registerId);

    @Insert("insert into tenant(register_id,identity) value(#{registerId},'1')")
    void insertById(Integer registerId);

    @Update("update tenant set photograph=#{photograph} where id=#{id}")
    int updatephotographById(@Param("photograph") String photograph, @Param("id") Integer tenantId);
}
